﻿package com.tudou.ad.components
{
    import flash.display.*;
    import flash.events.*;

    public class InfoCloseButton extends Sprite
    {
        private var closeButton:InteractiveObject;
        private var clickButton:InteractiveObject;
        public static const CLICK:String = "info click!";
        public static const CLOSE:String = "info close click!";

        public function InfoCloseButton(param1:InteractiveObject, param2:InteractiveObject)
        {
            this.clickButton = param1;
            this.closeButton = param2;
            var _loc_3:Boolean = true;
            this.buttonMode = true;
            this.useHandCursor = _loc_3;
            addChild(param1);
            param2.x = param1.width;
            addChild(param2);
            this.clickButton.addEventListener(MouseEvent.CLICK, mouseClickHlr);
            this.closeButton.addEventListener(MouseEvent.CLICK, mouseClickHlr);
            return;
        }// end function

        private function mouseClickHlr(event:MouseEvent) : void
        {
            if (event.target == clickButton)
            {
                dispatchEvent(new Event(CLICK));
            }
            else if (event.target == closeButton)
            {
                dispatchEvent(new Event(CLOSE));
            }
            return;
        }// end function

    }
}
